package com.lab.utils;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;

public class HttpUtil {
	 
	 
		/**
		 * 发送内容,使用UTF-8编码
		 */
		public static void send(HttpServletResponse response, String text) {
			response.setContentType("text/html;charset=utf-8");
			response.setCharacterEncoding("utf-8");
			response.setHeader("Access-Control-Allow-Origin", "*"); 
			response.setHeader("Pragma", "No-cache");
			response.setHeader("Cache-Control", "no-cache");
			response.setDateHeader("Expires", 0);
			try {
				PrintWriter out=response.getWriter();
				out.print(text);
				out.flush();
				out.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
}
